package com.xinghou.platform.server.api.controller;

import com.xinghou.platform.entity.req.UserRegistReq;
import com.xinghou.platform.entity.resp.UserInfoResp;
import com.xinghou.platform.server.api.bussiness.UserInfoBusinessService;
import com.xinghou.platform.util.ConfigUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 用户账户信息查询（个人中心-我）
 *
 * @author xuzhen
 */
@Controller
public class GetUserInfoCenterController extends BaseControl {

    @Resource
    private UserInfoBusinessService userInfoBusinessService;

    /*private UserRegistResp userRegistResp;

    private UserInfoResp userInfoResp;
*/
    private String reqjson;//请求json
    private String repjson;//返回json

    private String key = ConfigUtil.getProperty("HTTP_SERVICE_KEY");


    /**
     * 获取用户详情接口
     * @param userRegistReq
     * @param request
     * @param response
     * @return
     */
    @ResponseBody
    @SuppressWarnings({"unchecked", "rawtypes", "static-access"})
    @RequestMapping(value = "/findPersonInfo", method = {RequestMethod.POST})
    public String findPersonInfo( @RequestBody UserRegistReq userRegistReq,
                                 HttpServletRequest request, HttpServletResponse response) {
        UserInfoResp userInfoResp = new UserInfoResp();
            //记录访问记录
            userInfoResp = userInfoBusinessService.getUserInfo(userRegistReq.getUserid(), userRegistReq.getToUserid());
            userInfoBusinessService.recordVisitInfo(userRegistReq);
        return response(userInfoResp);
    }
    public String getReqjson() {
        return reqjson;
    }

    public void setReqjson(String reqjson) {
        this.reqjson = reqjson;
    }

    public String getRepjson() {
        return repjson;
    }

    public void setRepjson(String repjson) {
        this.repjson = repjson;
    }

}
